// eslint-disable-next-line @typescript-eslint/no-var-requires
const EventEmitter = require('events')
const subject = new EventEmitter()
subject.on('click', function (name) {
  console.log(1, name)
})
subject.on('click', function (name) {
  console.log(2, name)
})
subject.emit('click', 'ahhh')


/*
class EventEmitter{
    constructor() {
        this._events={};
    }
    on(type,listener) {
        let listeners=this._events[type];
        if (listeners) {
            listeners.push(listener);
        } else {
            this._events[type]=[listener];
        }
    }
    emit(type) {
        let listeners=this._events[type];
        let args=Array.from(arguments).slice(1);
        listeners.forEach(listener => listener(...args));
    }
}
module.exports = EventEmitter;
*/
